package com.bcxj.apidriver.controller;

import com.bcxj.apidriver.service.DriverUserService;
import com.bcxj.internalcommon.dto.ResponseResult;
import com.bcxj.internalcommon.entity.DriverCarBindingRelationship;
import com.bcxj.internalcommon.entity.DriverUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.xml.ws.Response;

/**
 * ClassName: DriverUserController
 * Package: com.bcxj.apidriver.controller
 * Description:
 *
 * @Author BCXJ
 * @Create 2024/10/19 17:05
 * @Version 1.0
 * @Since 1.0
 */
@RestController
@RequestMapping()
public class DriverUserController {

    @Autowired
    private DriverUserService driverUserService;

    /**
     * 修改司机的信息
     * @param driverUser
     * @return
     */
    @PutMapping("user")
    public ResponseResult updateDriverUser(@RequestBody DriverUser driverUser) {
        return driverUserService.updateDriverUser(driverUser);
    }

    /**
     * 根据司机的手机号获取car的信息
     * @param driverPhone
     * @return
     */
    @GetMapping("/driver-car-binding-relationship")
    public ResponseResult<DriverCarBindingRelationship> getDriverCarBindingRelationship(@RequestParam String driverPhone) {
        return driverUserService.getDriverCarBindingRelationship(driverPhone);
    }

}
